<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/common/taglibs.jsp" %>
<html>
<head>
    <title>作业添加</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <jsp:include page="/WEB-INF/views/common/include_css.jsp"/>
</head>
<body>
<form id="addHomework">
    <input type="hidden" id="id" name="id" value="${homework.id}">
    <div style="width: 800px;margin:0 auto">
        <div class="form-group">
            <label>作业标题</label>
            <input type="text" class="form-control" name="title" id="title" placeholder="作业标题">
        </div>
        <div class="form-group">
            <label>截至日期</label>

            <div class="input-group date form_date" data-date="" data-date-format="yyyy-mm-dd"
                 data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
                <input class="form-control" size="16" type="text" value="" readonly name="deadlineDate"
                       id="deadlineDate">
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </div>
        </div>
        <div class="form-group">
            <label>作业内容</label>
            <textarea class="form-control required" rows="12" name="content"></textarea>
        </div>
        <div class="form-group">
            <input type="hidden" id="filename" name="filename" value="${homework.filename}">
            <input type="hidden" id="fileSize" name="fileSize" value="${homework.fileSize}">
            <input type="hidden" id="suffix" name="suffix" value="${homework.suffix}">
            <input type="hidden" id="path" name="path" value="${homework.path}">
            <label>附件</label>
            <input type="button" value="选择文件" id="selectFileButton"
                   class="btn btn-primary btn-xs js-addShow js-editShow"/>
            <div id="fileListDiv" style="">
                <c:if test="${homework.filename != null && homework.filename != '' }">
                    <div>
                        <a href="${ctx}/study/homework/downloadFile?id=${homework.id}">${homework.filename}</a>
                        <a href="javascript:;" class="btn btn-danger btn-xs js-delFile js-addShow js-editShow"
                           style="margin-left: 10px;" data-id="${homework.id}">
                            <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
                            删除文件</a>
                    </div>
                </c:if>
            </div>
        </div>
        <button type="button" id="addButton" class="btn btn-default">保存</button>
    </div>
</form>
<script type="text/html" id="delFileTemplate">
    <div>
        <a href="${ctx}/study/homework/downloadFile?id={{id}}">{{filename}}</a>
        <a href="javascript:;" class="btn btn-danger btn-xs js-delFile js-addShow js-editShow"
           style="margin-left: 10px;" data-id="{{id}}">
            <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
            删除文件</a>
    </div>
</script>
<jsp:include page="/WEB-INF/views/common/include_javascript.jsp"/>
<script src="${ctx}/static/js/homework/homework_add.js"></script>
</body>

</html>
